import { API_URL } from "../constants";
import type { IRegion, IRequestListParams, IResponseList } from "../types";
import request from "./request";

export function getRegionList(
  params: IRequestListParams<{ regionName?: string }>,
  token: string,
  signal?: AbortSignal,
) {
  return request<IResponseList<{ rows: IRegion[] }>>(
    `${API_URL}/business/region/list`,
    {
      params: params as Record<string, string>,
      headers: { Authorization: token },
      signal,
    },
  );
}
